/**
 * Project Name:sc-client-zookeeper
 * File Name:AppClient.java
 * Package Name:com.labm.test.zk.client
 * Date:2016��12��23������3:15:33
 * Copyright (c) 2016, ����֪ʱ��Ϣ�Ƽ����޹�˾ All Rights Reserved.
 *
*/

package com.labm.test.zk.client;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName:AppClient <br/>
 * Function: <br/>
 * Date:     2016��12��23�� ����3:15:33 <br/>
 * @author   guooo
 * @version  
 * @since    JDK 1.6
 * @see 	 
 */
@SpringBootApplication  
@EnableDiscoveryClient  
@RestController  
public class AppClient {  
    @Autowired  
    private LoadBalancerClient loadBalancer;  
  
    @Autowired  
    private DiscoveryClient discovery;  
      
    @RequestMapping("/discovery")  
    public Object discovery() {  
        System.out.println(loadBalancer.choose("selelamb"));  
        return "discovery";  
    }  
      
    @RequestMapping("/all")  
    public Object all() {  
        System.out.println(discovery.getServices());  
        return "all";  
    }  
  
    public static void main(String[] args) {  
        SpringApplication.run(AppClient.class, args);  
    }  
}  

